﻿/*
    Write a program that reads from the console a sequence of n integer numbers and returns the minimal, 
    the maximal number, the sum and the average of all numbers (displayed with 2 digits after the decimal point).
    The input starts by the number n (alone in a line) followed by n lines, each holding an integer number.
    The output is like in the examples below.
 */


using System;
using System.Linq;
class MinMaxSumAverageOfNNumbers
{
    static void Main()
    {
        Console.WriteLine("How many numbers: ");
        int n = int.Parse(Console.ReadLine());

        int[] numbers = new int[n];
        for (int i = 0; i < n; i++)
        {
            Console.WriteLine("number " + (i + 1) + " is?: ");
            numbers[i] = int.Parse(Console.ReadLine());
        }
        int max = numbers[0];
        int min = max;
        long sum = numbers.Sum();
        double average = (double)sum / numbers.Length;

        for (int i = 0; i < n; i++)
        {
            if (max < numbers[i])
            {
                max = numbers[i];
            }
            if (min > numbers[i])
            {
                min = numbers[i];
            }

        }
        Console.WriteLine("Minimal numbers is: {0} " + " Maximal numbers is: {1} " + " Avarage is: {2:F2} " +  
            " sum is: {3} ", min, max, average, sum);

    }
}
